<template>
  <view class="area-cat">
    <cat-list
      ref="catList"
      :key="id"
      :area-id="id" />
    <maya-back-top :scroll-top="scrollTop" />
  </view>
</template>
<!-- 分区猫咪列表页 -->
<script>
import catList from '../index/components/cat-list.vue';
import mayaBackTop from '@/components/maya-back-top.vue';
export default {
  components: {
    catList,
    mayaBackTop,
  },
  data() {
    return {
      id: '',
      scrollTop: 0,
    };
  },
  onLoad(options) {
    this.id = options.id;
    uni.setNavigationBarTitle({
      title: options.name,
    });
  },
  // 页面滚动到底部的事件
  onReachBottom() {
    // 节流
    this.$refs.catList.loadMore();
  },
  onPageScroll(e) {
    // 节流
    uni.$u.throttle(() => {
      this.scrollTop = e.scrollTop;
    }, 500);
  },
};
</script>

<style lang="scss">
.area-cat{
	padding: $pd;
}
</style>
